package com.chainyoung.component_tmperson.ui.mvp.model;

import com.chainyoung.common.appcommon.entity.CommonList;
import com.chainyoung.common.di.scope.FragmentScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.api.PersonService;
import com.chainyoung.component_tmperson.entity.CoinItem;
import com.chainyoung.component_tmperson.entity.PurseAddrItem;
import com.chainyoung.component_tmperson.ui.mvp.contract.GetCoinContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.GetPurseListContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;

@FragmentScope
public class GetPurseListModel extends BaseModel implements GetPurseListContract.Model {

    @Inject
    GetPurseListModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);

    }


    @Override
    public Flowable<CommonList<PurseAddrItem>> getPurseList(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .getPurseAddrList(map)
                .compose(RxUtils.<CommonList<PurseAddrItem>>handleResult());
    }

    @Override
    public Flowable<String> delPurseAddr(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .delPurseAddr(map)
                .compose(RxUtils.<String>handleResult());
    }

}
